<template>
  <PageWrapper v-loading="queryLoading" loading-tip="加载中..." content-full-height>
    <div :class="`${prefixCls}-content`">
      <BasicForm @register="registerForm" @submit="handleSubmit" :class="`${prefixCls}-web-site`"> 
        <template #formFooter>
          <a-button :class="prefixCls + '-web-site-submit'" @click="handleSubmitBefore" type="primary" :loading="loading" style="margin-right: 0.9rem">确定</a-button>
        </template>
      </BasicForm>
    </div>
  </PageWrapper>
</template>
<script lang="ts" setup>
import {BasicForm} from '/@/components/Form/index';
import {tenantFormSchema} from '../data';
import {ConfigFormProps, useConfigForm} from '/@/hooks/my/useConfigForm'
import {ConfigKey} from '/@/views/system/config/config.model';
import {PageWrapper} from '/@/components/Page';
import {useDesign} from '/@/hooks/web/useDesign';
import {initPlatformConfig} from '/@/utils/tenant/index'

const emit = defineEmits(['query-success'])
const { prefixCls } = useDesign('config-center')

const configFromProps : ConfigFormProps = {
  configKey: ConfigKey.WEB_SITE,
  schemas: tenantFormSchema
}
const { registerForm, handleSubmit, loading, queryLoading } = useConfigForm(configFromProps, emit)

const handleSubmitBefore = async () => {
 await handleSubmit()
 initPlatformConfig()
}
</script>


<style lang="less" scoped>
@import '../style.less';
@prefix-cls: ~'@{namespace}-config-center';
.@{prefix-cls}-web-site {
  width: 750px;
  &-submit {
    margin-left: 100px;
  }
}

</style>
